﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Windows.Forms;

namespace AimGameEngine.NodeEditorObject
{
    partial class PropretyColor : Form
    {
        NodeColor nodecolor;
        public PropretyColor(NodeColor nodecolor)
        {
            InitializeComponent();
            this.nodecolor = nodecolor;

            this.trackBarAlpha.Value = (int)nodecolor.mycolor.A;
            this.trackBarRad.Value = (int)nodecolor.mycolor.R;
            this.trackBarGreen.Value = (int)nodecolor.mycolor.G;
            this.trackBarBlue.Value = (int)nodecolor.mycolor.B;
        }

        private void panel1_Paint(object sender, PaintEventArgs e)
        {
            Color c = Color.FromArgb(nodecolor.mycolor.A, nodecolor.mycolor.R, nodecolor.mycolor.G, nodecolor.mycolor.B);
            SolidBrush sb = new SolidBrush(c);
            e.Graphics.FillRectangle(sb, new Rectangle(0, 0, this.panel1.Width, this.panel1.Height));
        }

        private void trackBarRad_Scroll(object sender, EventArgs e)
        {
            nodecolor.mycolor = new Microsoft.Xna.Framework.Color((byte)this.trackBarRad.Value, nodecolor.mycolor.G, nodecolor.mycolor.B, nodecolor.mycolor.A);
            panel1.Refresh();
        }

        private void trackBarGreen_Scroll(object sender, EventArgs e)
        {
            nodecolor.mycolor = new Microsoft.Xna.Framework.Color(nodecolor.mycolor.R, (byte)this.trackBarGreen.Value, nodecolor.mycolor.B, nodecolor.mycolor.A);
            panel1.Refresh(); 
        }

        private void trackBarBlue_Scroll(object sender, EventArgs e)
        {
            nodecolor.mycolor = new Microsoft.Xna.Framework.Color(nodecolor.mycolor.R, nodecolor.mycolor.G, (byte)this.trackBarBlue.Value, nodecolor.mycolor.A);
            panel1.Refresh();
        }

        private void trackBarAlpha_Scroll(object sender, EventArgs e)
        {
            nodecolor.mycolor = new Microsoft.Xna.Framework.Color(nodecolor.mycolor.R, nodecolor.mycolor.G, nodecolor.mycolor.B, (byte)this.trackBarAlpha.Value);
            panel1.Refresh();
        }
        
    }
}
